package com.fishing.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fishing.entity.Notice;
import com.fishing.mapper.NoticeMapper;
import com.fishing.service.NoticeService;
@Service
public class NoticeServiceImpl implements NoticeService {
	@Autowired
	private NoticeMapper noticeMapper;

	@Override
	public int deleteByPrimaryKey(Integer id) throws Exception {
		return this.noticeMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(Notice record) throws Exception {
		return this.noticeMapper.insert(record);
	}

	@Override
	public Notice selectByPrimaryKey(Integer id) throws Exception {
		return this.noticeMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Notice> selectAll(String  PageIndex,String PageCount,int ZoneId) throws Exception {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("PageIndex", (Integer.parseInt(PageIndex) - 1) * Integer.parseInt(PageCount));
		map.put("PageCount", Integer.parseInt(PageCount));
		map.put("ZoneId", ZoneId);
		return this.noticeMapper.selectAll(map);
	}

	@Override
	public int selectCount(int ZoneId) {
		return noticeMapper.selectCount(ZoneId);
	}

}
